package com.sinitek.demo.library.service.impl;

import com.sinitek.demo.library.dto.BookDTO;
import com.sinitek.demo.library.dto.ContributeBookDTO;
import com.sinitek.demo.library.service.ILibraryBookService;
import java.util.ArrayList;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * @author 王志华
 * @date 2021/6/18
 */
@Slf4j
@Service
public class LibraryBookServiceImpl implements ILibraryBookService {

    @Override
    public List<BookDTO> findBooks() {
        log.debug("查询图书");
        List<BookDTO> list = new ArrayList<>();
        for(int i = 0; i < 3; i++){
            list.add(BookDTO
                .builder()
                .author(String.format("作者-%d", i))
                .isbn(String.format("978-%d-5049-6379-6", i))
                .name(String.format("练习册-%d", i))
                .build());
        }
        return list;
    }

    @Override
    public void contribute(ContributeBookDTO contributeBookDTO) {
        log.debug("捐赠图书:{}", contributeBookDTO);
    }
}
